package net.cyndeline

import scala.language.postfixOps
import java.util.UUID
import net.cyndeline.entitySystem.Component
import net.cyndeline.entitySystem.Event
import net.cyndeline.entitySystem.EntityRef

/**
 * This is the static part of a spell, consistent across every instance of
 * the spell.
 * 
 * @param passiveTriggers The set of triggers granted to its owner as long as
 * 						  the spell is being used.
 * @param area Identifier for the type of formula used to calculate the spells
 * 			   targeting area (includes single targeting)
 * @param conditions A list of every condition that using the spell at a target
 * 					 coordinate may fulfill.
 * @param events A collection that maps an integer value (number of conditions
 * 				 fulfilled) to a set of events to be applied to all targets.
 *      		 The spell should always have a default event factory mapped to
 *         		 level 0.
 * @param chargeAmount Number of max charges the spell starts with.
 * @param spellType What type of spell it is.
 * @param experience The total amount of experience needed to level up 
 * 					 the spell.
 */
class Spell(val passiveTriggers: List[Component], 
							val area: AreaType,
							val conditions: List[List[EntityRef] => Boolean],
							val events: Map[Int, List[Event]], // Just to make it compile, come up with something. A factory list.
							val chargeAmount: Int,
							val spellType: ItemEffectType,
							val experience: Int) {
  require((events contains(0)) && !(events(0) isEmpty))
  require(chargeAmount > 0)
  require(experience > 0)
}